package org.jvm.ydtest;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class MapThreadTest {
    Map<String,String>map=new HashMap<>();
    Map<String,String>map1=new ConcurrentHashMap<>();


    public  void helllo() throws  Exception{
        for (int i=0;i<50;i++){
            int finalI = i;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(10);
                        map.put(finalI +"","2");

                        map1.put(finalI +"","2");
                    }catch (Exception e){

                    }

                }
            }).start();
        }
        Thread.sleep(1000);
        System.out.println(map.size());
        System.out.println(map1.size());
    }
}
